package io.gitee.chearnee.fw.openapi.config;

import io.gitee.chearnee.fw.openapi.filter.OpenApiInterHandler;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@AllArgsConstructor
public class OpenApiWebAppConfigurer implements WebMvcConfigurer {

  private final OpenApiInterHandler openApiInterHandler;

  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    // 可添加多个
    registry.addInterceptor(openApiInterHandler).addPathPatterns("/**");
  }

}
